<?php

namespace Portal\ProfileBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Portal\ProfileBundle\Controller\ProfileController;
class ComponentController extends Controller
{
  public function myLessonListAction()
  {
    $user = ProfileController::checkUser($this->get('security.context'));
    $lessonArray = $this->getDoctrine()->getEntityManager()->getRepository('PortalLessonBundle:Lesson')->getMyLesson($user->getId());

    return $this->render('PortalProfileBundle:Component:lessonList.html.twig', array(        
        'lessonArray' => $lessonArray,
        ));
  }
  
  public function myContractListAction()
  {
    $user = ProfileController::checkUser($this->get('security.context'));
    $contractArray = $this->getDoctrine()->getEntityManager()->getRepository('PortalContractBundle:Contract')->getMyContract($user->getId());
    
    return $this->render('PortalProfileBundle:Component:contractList.html.twig', array(
                'contractArray' => $contractArray,
            ));
  }
  
  public function myInvoiceListAction()
  {
    $user = ProfileController::checkUser($this->get('security.context'));
    $invoiceArray = $this->getDoctrine()->getEntityManager()->getRepository('PortalInvoiceBundle:invoice')->myInvoice($user->getId());
    
    return $this->render('PortalProfileBundle:Component:invoiceList.html.twig', array(
                'invoiceArray' => $invoiceArray,
            ));
  }
  
}
